如何获得<option>与</option>之间的文本值?
来源:百度知道 编辑:UC知道 时间:2024/06/01 08:44:10
代码如下:
function a()
{
document.all["ygid"].value = document.all["sel"].value
}
<select name="sel" onChange="a()">
<option value="">--请选择姓名--</option>
<%set rs=server.CreateObject("adodb.recordset")
sql="select * from yginfo"
rs.open sql,conn,1,1
do while not rs.eof
response.write "<option name='"&rs("name")&"' value='"&rs("ygid")&"'>"&rs("name")&"</option>"
rs.movenext
loop%>
</select>
</td>
</tr>
<tr>
<td align="center" bordercolor="#0000FF" bgcolor="#999999"><span class="STYLE3">编号:</span></td>
<td align="center" bordercolor="#0000FF" bgcolor="#999999"
function a()
{
document.all["ygid"].value = document.all["sel"].value
}
<select name="sel" onChange="a()">
<option value="">--请选择姓名--</option>
<%set rs=server.CreateObject("adodb.recordset")
sql="select * from yginfo"
rs.open sql,conn,1,1
do while not rs.eof
response.write "<option name='"&rs("name")&"' value='"&rs("ygid")&"'>"&rs("name")&"</option>"
rs.movenext
loop%>
</select>
</td>
</tr>
<tr>
<td align="center" bordercolor="#0000FF" bgcolor="#999999"><span class="STYLE3">编号:</span></td>
<td align="center" bordercolor="#0000FF" bgcolor="#999999"
<SCRIPT LANGUAGE="JavaScript">
function a(obj)
{
document.getElementById("ygid").value=obj.options[obj.selectedIndex].value;
document.getElementById("ygname").value=obj.options[obj.selectedIndex].text;
}
</SCRIPT>
<select onchange="a(this)">
<option value="001">员工1</option>
<option value="002">员工2</option>
<option value="003">员工3</option>
<option value="004">员工4</option>
<option value="005">员工5</option>
</select><BR>
<input name="ygid" id="ygid" type="text" size="30" readonly="true">
<input name="ygname" id="ygname" type="text" size="30" readonly="true" >
看效果改吧
document.getElementById("下拉框ID属性值").opti
如何获得select的option值
如何获得select的option值 ASP
如何获得option中的value值?
<% Option Explicit %> 是什么意思
ASP中<%Option Explicit%>是什么意思?
<% Option Explicit %>是什么意思,初学asp :)
Response.Write "<option selected>"&i&"</option>" 中的<option>的用法
ASP程序的<% Option Explicit %>是什么意思?
document.write ("<option value='0'>电影</option>")还是有问题
关于取<option value="">显示值</option>显示值的问题